<?php

use yii\helpers\Url;
use yii\helpers\Html;
use website\helpers\Render;
use common\models\Design;
use common\models\Employment;

$this->title = '个人中心';
?>
<link rel="stylesheet" href="<?= Url::to('@web/web/static/css/index.css') ?>">
<style>
    .big-bar {float:left;width:50%;}
    .big-bar .panel {height:290px;margin:10px;background:#fafafa;box-shadow:0 0 5px rgba(0,0,0,0.4);background-position:center;background-repeat:no-repeat;}
    .big-bar .panel a {display:block;padding-top:210px;font-size:28px;text-align:center;text-decoration:none;}
    .small-bar {float:left;width:25%;}
    .small-bar .panel {position:relative;height:230px;margin:20px 0;border-left:1px solid #ccc;background-position:center;background-repeat:no-repeat;}
    .small-bar.first .panel {border-left:none;}
    .small-bar .panel a {display:block;padding-top:180px;font-size:22px;text-align:center;text-decoration:none;}
    .small-bar .panel .count {position:absolute;right:15px;top:15px;height:30px;line-height:30px;text-align:center;min-width:30px;border-radius:30px;background-color:#f00;color:#fff;}

    #info-table {padding:10px;}
    #info-table .designer-detail .panel {position:relative;padding:20px 10px;margin:5px;border-radius:5px;}
    #info-table .designer-detail .header {height:50px;line-height:25px;border-bottom:none;}
    #info-table .designer-detail .imager img {width:50px;height:50px;margin-right:20px;}
    #info-table .designer-detail .username {font-size:16px;}
    #info-table .designer-detail .bodyer {line-height:30px;font-size:12px;}
    #info-table .designer-detail .into {top:50px;width:90px;}
    #info-table .designer-detail .into-ensume {line-height:22px;border-radius:3px;}
    #info-table .designer-detail .delete-data {position:absolute;top:10px;right:10px;display:none;}
    #info-table .designer-detail .panel:hover .delete-data {display:block;}
    #flyer-button {margin:5px 0 0 40%;}
</style>

<div class="contenter">
    <?= $this->render('/user/navigator', ['active' => 'index']) ?>

    <div id="user-contenter">
        <div class="box-shadow" id="sub-contenter">
            <div class="data-title"><span class="h3"><?= $this->title ?></span></div>
            <div class="data-content clear" style="height:620px;">
                <div class="big-bar">
                    <div class="panel" style="background-image:url(<?= Url::to('@web/web/static/image/user/activity.png') ?>);background-size:100% 100%;">
                        <a href="#">敬请期待</a>
                    </div>
                </div>
                <div class="big-bar">
                    <div class="panel" style="background-image:url(<?= Url::to('@web/web/static/image/user/order.png') ?>);">
                        <a href="<?= Url::to('@web/employer/employment-list') ?>">我的订单</a>
                    </div>
                </div>
                <div class="big-bar">
                    <div class="panel" style="background-image:url(<?= Url::to('@web/web/static/image/user/paying.png') ?>);">
                        <a href="<?= Url::to('@web/employer/employment-list?status='.Employment::StatusConfirm) ?>">待付款</a>
                    </div>
                </div>
                <div class="big-bar">
                    <div class="panel" style="background-image:url(<?= Url::to('@web/web/static/image/user/wallet.png') ?>);">
                        <a href="<?= Url::to('@web/employer/wallet') ?>">托管资金</a>
                    </div>
                </div>
            </div>
            <div class="data-content pd-20px">
                <div class="box-shadow clear">
                    <div class="small-bar first">
                        <div class="panel" style="background-image:url(<?= Url::to('@web/web/static/image/user/recruit.png') ?>);">
                            <a href="<?= Url::to('@web/employer/recruit') ?>">发布招聘</a>
                        </div>
                    </div>
                    <div class="small-bar">
                        <div class="panel" style="background-image:url(<?= Url::to('@web/web/static/image/user/resume.png') ?>);">
                            <span class="count"><?= $receiveCount ?></span>
                            <a href="<?= Url::to('@web/employer/recruit-list') ?>">已收简历</a>
                        </div>
                    </div>
                    <div class="small-bar">
                        <div class="panel" style="background-image:url(<?= Url::to('@web/web/static/image/user/collection.png') ?>);">
                            <a href="<?= Url::to('@web/employer/collection-designer-list') ?>">我的收藏</a>
                        </div>
                    </div>
                    <div class="small-bar">
                        <div class="panel" style="background-image:url(<?= Url::to('@web/web/static/image/user/reader.png') ?>);">
                            <a href="<?= Url::to('@web/information/employment-reader') ?>">雇佣必读</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="data-content box-shadow pd-20px mt-20px">
            <div class="sub-title"><i></i>推荐简历</div>
            <div class="clear" id="info-table">
                <?php
                foreach($designers as $designer) { ?>
                    <div class="designer-detail boxing">
                        <div class="panel">
                            <div class="header">
                                <div class="imager"><img src="<?= Render::upload($designer->photo) ?>"></div>
                                <div class="user">
                                    <h3 class="username"><?= $designer->nickname ?></h3>
                                    <p class="star cl-red"><?= Render::star($designer->star) ?></p>
                                </div>
                            </div>
                            <div class="bodyer">
                                <p>擅长类目：<span class="categories"><?= $designer->categoriesString ?></span></p>
                                <p>擅长风格：<span class="styles"><?= $designer->stylesString ?></span></p>
                                <p>擅长软件：<?= $designer->skills ?></p>
                                <!--div class="into">
                                    <p>薪资：<//?= Render::amount($designer->salary, 0) ?>元</p>
                                    <p><a class="into-ensume" href="<//?= Url::to('@web/seer/resume?id='.$designer->id) ?>">进入简历 &gt;</a></p>
                                </div-->
                            </div>
                            <a class="delete-data flyer-button normal border-round narrow thin" href="<?= Url::to('@web/seer/resume?id='.$designer->id) ?>">进入简历</a>
                        </div>
                    </div>
                    <?php
                }
                ?>
            </div>
        </div>
    </div>
</div>
<div class="mt-20px" id="employment-bannero">
    <div class="employment-banner">
        <a class="flyer-button normal border-round huge" id="flyer-button" href="<?= Url::to('@web/employer/invites-courtesy') ?>" >邀请有礼</a>
    </div>
</div>
<div style="display:none;">
    <?= Render::select('styles', Design::$styleSelector, null, ['id' => 'style']) ?>
</div>
<script src="<?= Render::static('flyer/tableHandler.class.js') ?>"></script>
<script src="<?= Render::static('flyer/categorier.class.js') ?>"></script>
<script src="<?= Render::static('system/category-design.data.js') ?>"></script>
<script>
    var categorierClass = new categorier();
    $(document).ready(function() {
        categorierClass.init({ data: DesignCategories, relate: DesignCategoriesRelation, start: '<?= Yii::$app->params['designCategories'] ?>' });
        // 名称显示
        tableHandler.renderCategory({ category: $('.styles'), select: '#style', color: false, splite: '，', default: '--' });
        tableHandler.renderCategory({ category: $('.categories'), color: false, splite: '，', default: '--', functionName: function(id) {
            return categorierClass.renderTitles(id);
        }});
    });
</script>